﻿using System;
using System.Collections.Generic;
using Allegro.MathInterface;

namespace Allegro.Mathlib
{
    public interface IDifferentiation
    {
        /// <summary>
        /// Initial step size
        /// </summary>
        double StepSize { get; set; }

        /// <summary>
        /// Function to be differentiated
        /// </summary>
        Function Func { get; set; }

        /// <summary>
        /// Differentiate a function at x
        /// </summary>
        /// <param name="x"></param>
        /// <returns></returns>
        double Df(double x);
    }
    public interface IVectorDifferentiation
    {
        /// <summary>
        /// Vector function to be differentiated
        /// </summary>
        VectorFunction Func { get; set; }

        /// <summary>
        /// Compute gradient dfdx 
        /// </summary>
        /// <param name="x"></param>
        /// <param name="dfdx">Gradient dfdx[i] = df/dx[i]</param>
        void Df(double[] x, double[] dfdx);
    }
    public interface INumericalVectorDifferentiation : IVectorDifferentiation
    {
        /// <summary>
        /// Initial step sizes used for differentiation
        /// </summary>
        double[] StepSizes { get; set; }

        /// <summary>
        /// Differentiation method used to compute the gradient
        /// </summary>
        IDifferentiation DifferentiationMethod { get; set; }
    }
}
